package com.qczl.pme.entity;

import java.io.Serializable;
import java.util.Date;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * 摄像头信息表
 * 
 * @author SongR
 *
 */

@Entity
@Table(name = "pme_basis_camera")
public class PMECamera implements Serializable {
	private static final long serialVersionUID = -2707362312588720946L;
	private Long id;// 编号
	private String name;// 名称
	private Integer type;// 类型（0、会议室 1、公示栏2、直属部门）
	private Integer level;// 级别(0、主会场 1、分会场)
	private String url;// 播放流地址
	private String link;// 链接地址
	private String img;// 图片
	private Integer status;// 状态
	private Long sort;// 排序
	private Date creattime;// 创建时间
	private Long userId;// 创建者
	private String streamId;// 流编号
	private String rtsp;// rtsp地址
	private PMESewise sewise; //对应的推流服务器
	private Set<PMESTB> stbs;//绑定的机顶盒
	private PMEArea area;//对应的区域
	private Set<PMEVideo> videos;//录制的视频
	private Set<PMEMetting> mettings;//组织的会议

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = "camera_id")
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}
	@Column(name = "camera_name")
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	@Column(name = "camera_type")
	public Integer getType() {
		return type;
	}

	public void setType(Integer type) {
		this.type = type;
	}
	@Column(name = "camera_level")
	public Integer getLevel() {
		return level;
	}

	public void setLevel(Integer level) {
		this.level = level;
	}
	@Column(name = "camera_url")
	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}
	@Column(name = "camera_link")
	public String getLink() {
		return link;
	}

	public void setLink(String link) {
		this.link = link;
	}
	@Column(name = "camera_img")
	public String getImg() {
		return img;
	}

	public void setImg(String img) {
		this.img = img;
	}
	@Column(name = "camera_status")
	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}
	@Column(name = "camera_sort")
	public Long getSort() {
		return sort;
	}

	public void setSort(Long sort) {
		this.sort = sort;
	}
	@Column(name = "camera_creattime")
	public Date getCreattime() {
		return creattime;
	}

	public void setCreattime(Date creattime) {
		this.creattime = creattime;
	}
	@Column(name = "camera_user_id")
	public Long getUserId() {
		return userId;
	}

	public void setUserId(Long userId) {
		this.userId = userId;
	}
	@Column(name = "camera_streamid")
	public String getStreamId() {
		return streamId;
	}

	public void setStreamId(String streamId) {
		this.streamId = streamId;
	}
	@Column(name = "camera_rtsp")
	public String getRtsp() {
		return rtsp;
	}

	public void setRtsp(String rtsp) {
		this.rtsp = rtsp;
	}
	@ManyToOne(cascade = CascadeType.ALL,fetch=FetchType.EAGER)
	@JoinColumn(name = "sewise_id", referencedColumnName = "sewise_id",nullable=false)
	public PMESewise getSewise() {
		return sewise;
	}

	public void setSewise(PMESewise sewise) {
		this.sewise = sewise;
	}
	@ManyToMany(cascade = CascadeType.ALL,fetch=FetchType.EAGER)
	@JoinTable(name = "pme_basis_stb_camera", joinColumns = @JoinColumn(name = "camera_id") , inverseJoinColumns = @JoinColumn(name = "stb_id") )
	public Set<PMESTB> getStbs() {
		return stbs;
	}

	public void setStbs(Set<PMESTB> stbs) {
		this.stbs = stbs;
	}
	@ManyToOne(cascade = CascadeType.ALL,fetch=FetchType.EAGER)
	@JoinColumn(name = "area_id", referencedColumnName = "area_id",nullable=false)
	public PMEArea getArea() {
		return area;
	}

	public void setArea(PMEArea area) {
		this.area = area;
	}
	@OneToMany(mappedBy = "camera", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
	public Set<PMEVideo> getVideos() {
		return videos;
	}

	public void setVideos(Set<PMEVideo> videos) {
		this.videos = videos;
	}
	@OneToMany(mappedBy = "camera", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
	public Set<PMEMetting> getMettings() {
		return mettings;
	}

	public void setMettings(Set<PMEMetting> mettings) {
		this.mettings = mettings;
	}
}
